import java.util.List;

/**
 * @Auther: wangliuyang
 * @Date: 2021/4/23 10:41
 * @Description: 83. 删除排序链表中的重复元素
 */
public class Solution_83 {
    public ListNode deleteDuplicates(ListNode head) {
        ListNode hair = new ListNode(Integer.MIN_VALUE,head);
        ListNode tail = hair;
        ListNode cur = head;
        while (cur != null) {
            if (cur.val == tail.val) {
                cur = cur.next;
            }else {
                tail.next = cur;
                tail = cur;
                cur = cur.next;
            }
        }
        tail.next = null;
        return hair.next;
    }
}
